#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
using namespace std;

int main()
{
    int n = 0;
    int count = 0;
    int new_count = 0;
    cin >> n;
    for (int i = 0; i < 32; i++)
    {
        if (((1 << i) & n))
        {
            new_count++;
        }
        if (((1 << i) & n) == 0)
        {
            count = new_count > count ? new_count : count;
            new_count = 0;
        }
    }
    count = new_count > count ? new_count : count;
    cout << count;
    return 0;
}